package org.gruposp2p.proyectokarma.gwt.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import org.gruposp2p.proyectokarma.gwt.client.domain.Tag;
import java.util.Set;

public class TagsEvent extends GwtEvent {
	
    private static final GwtEvent.Type TYPE = new GwtEvent.Type();
    
    public enum Action {EDITION, DELETION, ADDITION, OBTAINED}

    public Set<Tag> tags;
    public Action eventAction;

    public static GwtEvent.Type getType() { return TYPE;}

    @Override
    public Type getAssociatedType() { return TYPE;}

    @Override
    protected void dispatch(EventHandler handler) {
    	((TagsEvent.Handler)handler).onTagsChanged(this);
    }

    public TagsEvent (Set<Tag> tags, Action eventAction) {
        this.tags = tags;
        this.eventAction = eventAction;
    }
    
    /**
     * Implemented by handlers of this type of event.
     */
    public interface Handler extends EventHandler {
    	void onTagsChanged(TagsEvent event);
    }

}